/*
 * @Author       : Bing Chen chenbing@iocharger.com
 * @Date         : 2024-12-23 16:24:13
 * @LastEditors  : Bing Chen chenbing@iocharger.com
 * @LastEditTime : 2025-03-15 13:00:47
 * @FilePath     : \openchaoji-corelib\shared\src\OpenChaoJi_gbt27930_b_encode.c
 * @Description  :
 *
 * Copyright (c) 2025 OpenChaoJi
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the icense for the specific language governing permissions and
 * limitations under the License.
 *
 */
#include "../include/OpenChaoJi_shared.h"

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B == CONFIG_YES)

/**
 * bs方法, 辅助进行字节流传输
 */
#include "bs.h"
#define bs_read     bs_read_le
#define bs_write    bs_write_le

/*********************************************************************************************************************************************/

/**
 * @function OpenChaoJi_gbt27930_b_msg_len
 * @brief 获取消息长度
 * @param pgi 消息类型
 * @return int 消息长度
 */
extern int OpenChaoJi_gbt27930_b_msg_len(uint8_t pgi)
{
    switch (pgi) {
    case OPENCHAOJI_GBT27930_B_PGI_FUNC_NEGO_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_SUPPORT_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_FUNC_NEGO_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_SUPPORT_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_PARAM_CONFIG_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_PARAM_CONFIG_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_PARAM_CONFIG_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_PARAM_CONFIG_EVCC;
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_AUTH == CONFIG_YES)
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_RFID == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_PARAM_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_AUTH_RFID_PARAM_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_WAIT_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_AUTH_RFID_WAIT_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_RESULT_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_AUTH_RFID_RESULT_SECC;
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_EVIN == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_REQ_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_AUTH_EVIN_REQ_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_PARAM_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_AUTH_EVIN_PARAM_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_RESULT_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_AUTH_EVIN_RESULT_SECC;
#endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_RESERVE == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_RESERVE_EVCC == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_INFO_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_RESERVE_INFO_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_CONFIRM_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_RESERVE_CONFIRM_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_INFO_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_RESERVE_INFO_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_NEGO_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_RESERVE_NEGO_EVCC;
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SELFCHECK == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SELFCHECK_GENERAL == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_SELFCHECK_STATUS_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_SELFCHECK_STATUS_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_SELFCHECK_RESULT_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_SELFCHECK_RESULT_SECC;
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SUPPLY == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SUPPLY_BASIC == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_STATUS_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_SUPPLY_STATUS_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_STATUS_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_SUPPLY_STATUS_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_REQUIREMENT_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_SUPPLY_REQUIREMENT_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_ABILITY_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_SUPPLY_ABILITY_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_FINISH_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_FUNC_SUPPLY_FINISH_EVCC;
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_CHARGING == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_READY_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_CHARGING_READY_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_READY_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_CHARGING_READY_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_REQUIREMENT_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_CHARGING_REQUIREMENT_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_INFO_BASIC_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_CHARGING_INFO_BASIC_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_INFO_BATTERY_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_CHARGING_INFO_BATTERY_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_ABILITY_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_CHARGING_ABILITY_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_PAUSE_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_CHARGING_PAUSE_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_PAUSE_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_CHARGING_PAUSE_EVCC;
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_DISCHARGING == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_READY_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_DISCHARGING_READY_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_READY_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_DISCHARGING_READY_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_REQUIREMENT_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_DISCHARGING_REQUIREMENT_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_STATUS_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_DISCHARGING_STATUS_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_INFO_BASIC_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_DISCHARGING_INFO_BASIC_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_ABILITY_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_DISCHARGING_ABILITY_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_STATUS_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_DISCHARGING_STATUS_SECC;
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_STATISTICS == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_STATISTICS == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_STATISTICS_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_STATISTICS_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_STATISTICS_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_STATISTICS_EVCC;
    #endif
#endif
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_PHASE_INFO_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_PHASE_INFO_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_PHASE_ACK_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_PHASE_ACK_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_STOP_INFO_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_STOP_INFO_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_STOP_INFO_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_STOP_INFO_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_RELAY_STATUS_SECC: return OPENCHAOJI_GBT27930_B_MSG_LEN_RELAY_STATUS_SECC;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_RELAY_STATUS_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_RELAY_STATUS_EVCC;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_LATCHING_STATUS_EVCC: return OPENCHAOJI_GBT27930_B_MSG_LEN_LATCHING_STATUS_EVCC;
    default:
        return 0;
    }
}


/*********************************************************************************************************************************************/

/**
 * 各类型PGI的编码
 */

static bool OpenChaoJi_gbt27930_b_msg_decode_func_nego_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    int i;
    msg->msg.func_support_secc.pid = bs_read(&bs, 8);

    #define FUNC_SUPPORT_SECC_READ_FDC(FDC_NAME) \
    for (i = 0; i < 8; i++) { \
        msg->msg.func_support_secc.fdc_support_##FDC_NAME[i] = bs_read(&bs, 8);\
        \
        if (msg->msg.func_support_secc.fdc_support_##FDC_NAME[i] != OPENCHAOJI_GBT27930_B_FDC_SUPPORT_TYPE_SUPPORT\
        && msg->msg.func_support_secc.fdc_support_##FDC_NAME[i] != OPENCHAOJI_GBT27930_B_FDC_SUPPORT_TYPE_NOT_SUPPORT) {\
            LOG_ERR("Invalid fdc_support_"#FDC_NAME"[%d]=%d", i, msg->msg.func_support_secc.fdc_support_##FDC_NAME[i]);\
            return false;\
        }\
    }

    FUNC_SUPPORT_SECC_READ_FDC(auth)
    FUNC_SUPPORT_SECC_READ_FDC(reserve)
    FUNC_SUPPORT_SECC_READ_FDC(selfcheck)
    FUNC_SUPPORT_SECC_READ_FDC(supply)
    FUNC_SUPPORT_SECC_READ_FDC(energy)
    FUNC_SUPPORT_SECC_READ_FDC(statistics)
    FUNC_SUPPORT_SECC_READ_FDC(service_idle)

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_func_nego_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.func_support_evcc.pid = bs_read(&bs, 8);

    #define FUNC_SUPPORT_EVCC_READ_FDC(FDC_NAME) \
    msg->msg.func_support_evcc.fdc_##FDC_NAME = bs_read(&bs, 8);\
    if (msg->msg.func_support_evcc.fdc_##FDC_NAME > 2\
        && msg->msg.func_support_evcc.fdc_##FDC_NAME != OPENCHAOJI_GBT27930_B_FDC_SUPPORT_TYPE_NOT_SUPPORT){\
        LOG_ERR("Invalid fdc_"#FDC_NAME"=%d", msg->msg.func_support_evcc.fdc_##FDC_NAME);\
        return false;\
    }

    FUNC_SUPPORT_EVCC_READ_FDC(auth)
    FUNC_SUPPORT_EVCC_READ_FDC(reserve)
    FUNC_SUPPORT_EVCC_READ_FDC(selfcheck)
    FUNC_SUPPORT_EVCC_READ_FDC(supply)
    FUNC_SUPPORT_EVCC_READ_FDC(energy)
    FUNC_SUPPORT_EVCC_READ_FDC(statistics)
    FUNC_SUPPORT_EVCC_READ_FDC(service_idle)

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_param_config_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.param_config_secc.pid = bs_read(&bs, 8);
    msg->msg.param_config_secc.parameter_max_charging_volt = bs_read(&bs, 16);
    msg->msg.param_config_secc.parameter_min_charging_volt = bs_read(&bs, 16);
    msg->msg.param_config_secc.parameter_max_charging_curr = bs_read(&bs, 16);
    msg->msg.param_config_secc.parameter_min_charging_curr = bs_read(&bs, 16);
    msg->msg.param_config_secc.parameter_max_discharge_volt = bs_read(&bs, 16);
    msg->msg.param_config_secc.parameter_min_discharge_volt = bs_read(&bs, 16);
    msg->msg.param_config_secc.parameter_max_discharge_curr = bs_read(&bs, 16);
    msg->msg.param_config_secc.parameter_min_discharge_curr = bs_read(&bs, 16);
    msg->msg.param_config_secc.parameter_raise_rate_curr = bs_read(&bs, 16);
    msg->msg.param_config_secc.parameter_reduce_rate_curr = bs_read(&bs, 16);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_param_config_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.param_config_evcc.pid = bs_read(&bs, 8);
    msg->msg.param_config_evcc.parameter_max_charging_curr = bs_read(&bs, 16);
    msg->msg.param_config_evcc.parameter_max_charging_volt = bs_read(&bs, 16);
    msg->msg.param_config_evcc.parameter_max_charging_energy = bs_read(&bs, 16);
    msg->msg.param_config_evcc.parameter_soc = bs_read(&bs, 16);
    msg->msg.param_config_evcc.parameter_max_battery_volt = bs_read(&bs, 16);
    msg->msg.param_config_evcc.parameter_max_battery_temperature = bs_read(&bs, 8);
    msg->msg.param_config_evcc.parameter_max_discharge_energy = bs_read(&bs, 16);
    msg->msg.param_config_evcc.parameter_min_discharge_volt = bs_read(&bs, 16);
    msg->msg.param_config_evcc.parameter_max_discharge_curr = bs_read(&bs, 16);
    msg->msg.param_config_evcc.parameter_min_discharge_curr = bs_read(&bs, 8);

    return true;
}

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_AUTH == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_RFID == CONFIG_YES)
static bool OpenChaoJi_gbt27930_b_msg_decode_auth_rfid_param_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.auth_rfid_param_secc.pid = bs_read(&bs, 8);
    msg->msg.auth_rfid_param_secc.c_authen_status = bs_read(&bs, 8);
    msg->msg.auth_rfid_param_secc.m_time = bs_read(&bs, 16);

    if (msg->msg.auth_rfid_param_secc.c_authen_status != OPENCHAOJI_GBT27930_B_SECC_AUTH_STATUS_START_CONTINUE
    && msg->msg.auth_rfid_param_secc.c_authen_status != OPENCHAOJI_GBT27930_B_SECC_AUTH_STATUS_FINISHED) {
        LOG_ERR("Invalid c_authen_status: %d", msg->msg.auth_rfid_param_secc.c_authen_status);
        return false;
    }

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_auth_rfid_wait_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.auth_rfid_wait_evcc.pid = bs_read(&bs, 8);
    msg->msg.auth_rfid_wait_evcc.v_authen_status = bs_read(&bs, 8);

    if (msg->msg.auth_rfid_wait_evcc.v_authen_status != OPENCHAOJI_GBT27930_B_EVCC_AUTH_STATUS_WAIT_REJECTED
    && msg->msg.auth_rfid_wait_evcc.v_authen_status != OPENCHAOJI_GBT27930_B_EVCC_AUTH_STATUS_WAIT_CONTINUE) {
        LOG_ERR("Invalid v_authen_status: %d", msg->msg.auth_rfid_wait_evcc.v_authen_status);
        return false;
    }

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_auth_rfid_result_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.auth_rfid_result_secc.pid = bs_read(&bs, 8);
    msg->msg.auth_rfid_result_secc.authen_result = bs_read(&bs, 8);

    if (msg->msg.auth_rfid_result_secc.authen_result != OPENCHAOJI_GBT27930_B_AUTH_RESULT_FAILED
    && msg->msg.auth_rfid_result_secc.authen_result != OPENCHAOJI_GBT27930_B_AUTH_RESULT_SUCCEED) {
        LOG_ERR("Invalid authen_result: %d", msg->msg.auth_rfid_result_secc.authen_result);
        return false;
    }

    return true;
}
    #endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_EVIN == CONFIG_YES)

static bool OpenChaoJi_gbt27930_b_msg_decode_auth_evin_req_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.auth_evin_req_secc.pid = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_auth_evin_param_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.auth_evin_param_evcc.pid = bs_read(&bs, 8);
    for (int i = 0; i < 17; i++)
    {
        msg->msg.auth_evin_param_evcc.evin[i] = bs_read(&bs, 8);
    }

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_auth_evin_result_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.auth_evin_result_secc.pid = bs_read(&bs, 8);
    msg->msg.auth_evin_result_secc.authen_result = bs_read(&bs, 8);

    if (msg->msg.auth_evin_result_secc.authen_result != OPENCHAOJI_GBT27930_B_AUTH_RESULT_FAILED
    && msg->msg.auth_evin_result_secc.authen_result != OPENCHAOJI_GBT27930_B_AUTH_RESULT_SUCCEED) {
        LOG_ERR("Invalid authen_result: %d", msg->msg.auth_evin_result_secc.authen_result);
        return false;
    }

    return true;
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_RESERVE == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_RESERVE_EVCC == CONFIG_YES)

static bool OpenChaoJi_gbt27930_b_msg_decode_reserve_info_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.reserve_info_secc.pid = bs_read(&bs, 8);
    msg->msg.reserve_info_secc.max_power = bs_read(&bs, 16);
    msg->msg.reserve_info_secc.coded_time = bs_read(&bs, 8);
    for (int i = 0; i < 192; i++)
    {
        msg->msg.reserve_info_secc.power_rate[i] = bs_read(&bs, 8);
    }

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_reserve_confirm_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.reserve_confirm_secc.pid = bs_read(&bs, 8);
    msg->msg.reserve_confirm_secc.reservation_confirm = bs_read(&bs, 8);
    msg->msg.reserve_confirm_secc.charging_now_flag = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_reserve_info_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.reserve_info_evcc.pid = bs_read(&bs, 8);
    msg->msg.reserve_info_evcc.start_time = bs_read(&bs, 16);
    msg->msg.reserve_info_evcc.set_out_time = bs_read(&bs, 16);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_reserve_nego_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.reserve_nego_evcc.pid = bs_read(&bs, 8);
    msg->msg.reserve_nego_evcc.consult_result = bs_read(&bs, 8);
    msg->msg.reserve_nego_evcc.charging_now_flag = bs_read(&bs, 8);

    return true;
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SELFCHECK == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SELFCHECK_GENERAL == CONFIG_YES)

static bool OpenChaoJi_gbt27930_b_msg_decode_selfcheck_status_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.selfcheck_status_secc.pid = bs_read(&bs, 8);
    msg->msg.selfcheck_status_secc.check_adhesion_status = bs_read(&bs, 8);
    msg->msg.selfcheck_status_secc.check_short_circuit_status = bs_read(&bs, 8);
    msg->msg.selfcheck_status_secc.check_insulation_status = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_selfcheck_result_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.selfcheck_result_secc.pid = bs_read(&bs, 8);
    msg->msg.selfcheck_result_secc.check_adhesion_result = bs_read(&bs, 8);
    msg->msg.selfcheck_result_secc.check_short_circuit_result = bs_read(&bs, 8);
    msg->msg.selfcheck_result_secc.check_insulation_result = bs_read(&bs, 8);

    return true;
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SUPPLY == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SUPPLY_BASIC == CONFIG_YES)
#endif

#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_CHARGING == CONFIG_YES)

static bool OpenChaoJi_gbt27930_b_msg_decode_charging_ready_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.charging_ready_secc.pid = bs_read(&bs, 8);
    msg->msg.charging_ready_secc.ready_status = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_charging_ready_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.charging_ready_evcc.pid = bs_read(&bs, 8);
    msg->msg.charging_ready_evcc.voltage = bs_read(&bs, 16);
    msg->msg.charging_ready_evcc.ready_status = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_charging_requirement_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.charging_requirement_evcc.pid = bs_read(&bs, 8);
    msg->msg.charging_requirement_evcc.voltage = bs_read(&bs, 16);
    msg->msg.charging_requirement_evcc.current = bs_read(&bs, 16);
    msg->msg.charging_requirement_evcc.charge_mode = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_charging_info_basic_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.charging_info_basic_evcc.pid = bs_read(&bs, 8);
    msg->msg.charging_info_basic_evcc.soc = bs_read(&bs, 16);
    msg->msg.charging_info_basic_evcc.left_time = bs_read(&bs, 16);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_charging_info_battery_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.charging_info_battery_evcc.pid = bs_read(&bs, 8);
    msg->msg.charging_info_battery_evcc.voltage_max = bs_read(&bs, 16);
    msg->msg.charging_info_battery_evcc.voltage_min = bs_read(&bs, 16);
    msg->msg.charging_info_battery_evcc.temperature_max = bs_read(&bs, 8);
    msg->msg.charging_info_battery_evcc.temperature_min = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_charging_ability_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.charging_ability_secc.pid = bs_read(&bs, 8);
    msg->msg.charging_ability_secc.current = bs_read(&bs, 16);
    msg->msg.charging_ability_secc.reason = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_charging_pause_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.charging_pause_secc.pid = bs_read(&bs, 8);
    msg->msg.charging_pause_secc.pause_status = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_charging_pause_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.charging_pause_evcc.pid = bs_read(&bs, 8);
    msg->msg.charging_pause_evcc.pause_status = bs_read(&bs, 8);

    return true;
}
#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_DISCHARGING == CONFIG_YES)
#endif


#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_STATISTICS == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_STATISTICS == CONFIG_YES)

static bool OpenChaoJi_gbt27930_b_msg_decode_statistics_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.statistics_secc.pid = bs_read(&bs, 8);
    msg->msg.statistics_secc.charge_total_energy = bs_read(&bs, 16);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_statistics_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.statistics_evcc.pid = bs_read(&bs, 8);
    msg->msg.statistics_evcc.charge_stop_SOC = bs_read(&bs, 16);

    return true;
}
    #endif

#endif


static bool OpenChaoJi_gbt27930_b_msg_decode_public_phase_info_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.phase_info_secc.pid = bs_read(&bs, 8);
    msg->msg.phase_info_secc.fc_type = bs_read(&bs, 8);
    msg->msg.phase_info_secc.fdc_type = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_public_phase_ack_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.phase_ack_evcc.pid = bs_read(&bs, 8);
    msg->msg.phase_ack_evcc.phase_ack = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_public_stop_info_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.stop_info_secc.pid = bs_read(&bs, 8);
    msg->msg.stop_info_secc.end_code = bs_read(&bs, 8);
    msg->msg.stop_info_secc.end_Reason = bs_read(&bs, 8);
    for (int i = 0; i < 4; i++)
    {
        msg->msg.stop_info_secc.fault_code[i] = bs_read(&bs, 8);
    }

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_public_stop_info_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.stop_info_evcc.pid = bs_read(&bs, 8);
    msg->msg.stop_info_evcc.end_code = bs_read(&bs, 8);
    msg->msg.stop_info_evcc.end_Reason = bs_read(&bs, 8);
    for (int i = 0; i < 4; i++)
    {
        msg->msg.stop_info_evcc.fault_code[i] = bs_read(&bs, 8);
    }

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_public_relay_status_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.relay_status_secc.pid = bs_read(&bs, 8);
    msg->msg.relay_status_secc.contact_c1 = bs_read(&bs, 8);
    msg->msg.relay_status_secc.contact_c2 = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_public_relay_status_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.relay_status_evcc.pid = bs_read(&bs, 8);
    msg->msg.relay_status_evcc.contact_c5 = bs_read(&bs, 8);
    msg->msg.relay_status_evcc.contact_c6 = bs_read(&bs, 8);

    return true;
}

static bool OpenChaoJi_gbt27930_b_msg_decode_public_latching_status_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    bs_t bs;
    bs_init(&bs, data, len);

    msg->msg.latching_status_evcc.pid = bs_read(&bs, 8);
    msg->msg.latching_status_evcc.latching_status = bs_read(&bs, 8);

    return true;
}

/**
 * @function OpenChaoJi_gbt27930_b_msg_decode
 * @brief 解码
 * @param msg 消息结构体(输出)
 * @param data 数据(输入)
 * @param len 数据长度
 * @return true 成功
 */
bool OpenChaoJi_gbt27930_b_msg_decode(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int len)
{
    if (msg == NULL || data == NULL) {
        LOG_CRIT("msg or data is NULL");
        return false;
    }

    if (len < 1) {
        LOG_ERR("gbt_b data_len[%d] < 1", len);
        return false;
    }

    int pgi_len = OpenChaoJi_gbt27930_b_msg_len(data[0]);
    if (len < pgi_len) {
        LOG_ERR("gbt_b data_len[%d] < pgi_len[%d]", len, pgi_len);
        return false;
    }

    msg->pid = data[0];

    switch (data[0]) {
    case OPENCHAOJI_GBT27930_B_PGI_FUNC_NEGO_SECC: return OpenChaoJi_gbt27930_b_msg_decode_func_nego_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_FUNC_NEGO_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_func_nego_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_PARAM_CONFIG_SECC: return OpenChaoJi_gbt27930_b_msg_decode_param_config_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_PARAM_CONFIG_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_param_config_evcc(msg, data, len);
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_AUTH == CONFIG_YES)
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_RFID == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_PARAM_SECC: return OpenChaoJi_gbt27930_b_msg_decode_auth_rfid_param_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_WAIT_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_auth_rfid_wait_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_RESULT_SECC: return OpenChaoJi_gbt27930_b_msg_decode_auth_rfid_result_secc(msg, data, len);
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_EVIN == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_REQ_SECC: return OpenChaoJi_gbt27930_b_msg_decode_auth_evin_req_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_PARAM_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_auth_evin_param_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_RESULT_SECC: return OpenChaoJi_gbt27930_b_msg_decode_auth_evin_result_secc(msg, data, len);
#endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_RESERVE == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_RESERVE_EVCC == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_INFO_SECC: return OpenChaoJi_gbt27930_b_msg_decode_reserve_info_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_CONFIRM_SECC: return OpenChaoJi_gbt27930_b_msg_decode_reserve_confirm_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_INFO_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_reserve_info_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_NEGO_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_reserve_nego_evcc(msg, data, len);
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SELFCHECK == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SELFCHECK_GENERAL == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_SELFCHECK_STATUS_SECC: return OpenChaoJi_gbt27930_b_msg_decode_selfcheck_status_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_SELFCHECK_RESULT_SECC: return OpenChaoJi_gbt27930_b_msg_decode_selfcheck_result_secc(msg, data, len);
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SUPPLY == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SUPPLY_BASIC == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_STATUS_SECC: return OpenChaoJi_gbt27930_b_msg_decode_supply_status_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_STATUS_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_supply_status_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_REQUIREMENT_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_supply_requirement_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_ABILITY_SECC: return OpenChaoJi_gbt27930_b_msg_decode_supply_ability_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_FINISH_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_supply_finish_evcc(msg, data, len);
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_CHARGING == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_READY_SECC: return OpenChaoJi_gbt27930_b_msg_decode_charging_ready_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_READY_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_charging_ready_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_REQUIREMENT_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_charging_requirement_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_INFO_BASIC_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_charging_info_basic_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_INFO_BATTERY_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_charging_info_battery_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_ABILITY_SECC: return OpenChaoJi_gbt27930_b_msg_decode_charging_ability_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_PAUSE_SECC: return OpenChaoJi_gbt27930_b_msg_decode_charging_pause_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_PAUSE_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_charging_pause_evcc(msg, data, len);
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_DISCHARGING == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_READY_SECC: return OpenChaoJi_gbt27930_b_msg_decode_discharging_ready_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_READY_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_discharging_ready_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_REQUIREMENT_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_discharging_requirement_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_STATUS_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_discharging_status_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_INFO_BASIC_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_discharging_info_basic_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_ABILITY_SECC: return OpenChaoJi_gbt27930_b_msg_decode_discharging_ability_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_STATUS_SECC: return OpenChaoJi_gbt27930_b_msg_decode_discharging_status_secc(msg, data, len);
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_STATISTICS == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_STATISTICS == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_STATISTICS_SECC: return OpenChaoJi_gbt27930_b_msg_decode_statistics_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_STATISTICS_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_statistics_evcc(msg, data, len);
    #endif
#endif
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_PHASE_INFO_SECC: return OpenChaoJi_gbt27930_b_msg_decode_public_phase_info_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_PHASE_ACK_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_public_phase_ack_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_STOP_INFO_SECC: return OpenChaoJi_gbt27930_b_msg_decode_public_stop_info_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_STOP_INFO_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_public_stop_info_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_RELAY_STATUS_SECC: return OpenChaoJi_gbt27930_b_msg_decode_public_relay_status_secc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_RELAY_STATUS_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_public_relay_status_evcc(msg, data, len);
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_LATCHING_STATUS_EVCC: return OpenChaoJi_gbt27930_b_msg_decode_public_latching_status_evcc(msg, data, len);
    default:
        return false;
    }
}


/*********************************************************************************************************************************************/

/**
 * 各类型PGI消息编码
 */
static void OpenChaoJi_gbt27930_b_msg_encode_func_nego_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    int i;
    bs_write(&bs, msg->msg.func_support_secc.pid, 8);

    #define FUNC_SUPPORT_SECC_WRITE_FDC(FDC_NAME) \
    for (i = 0; i < 8; i++) { \
        bs_write(&bs, msg->msg.func_support_secc.fdc_support_##FDC_NAME[i], 8);\
    }

    FUNC_SUPPORT_SECC_WRITE_FDC(auth)
    FUNC_SUPPORT_SECC_WRITE_FDC(reserve)
    FUNC_SUPPORT_SECC_WRITE_FDC(selfcheck)
    FUNC_SUPPORT_SECC_WRITE_FDC(supply)
    FUNC_SUPPORT_SECC_WRITE_FDC(energy)
    FUNC_SUPPORT_SECC_WRITE_FDC(statistics)
    FUNC_SUPPORT_SECC_WRITE_FDC(service_idle)
}

static void OpenChaoJi_gbt27930_b_msg_encode_func_nego_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.func_support_evcc.pid, 8);

    #define FUNC_SUPPORT_EVCC_WRITE_FDC(FDC_NAME) bs_write(&bs, msg->msg.func_support_evcc.fdc_##FDC_NAME, 8);

    FUNC_SUPPORT_EVCC_WRITE_FDC(auth)
    FUNC_SUPPORT_EVCC_WRITE_FDC(reserve)
    FUNC_SUPPORT_EVCC_WRITE_FDC(selfcheck)
    FUNC_SUPPORT_EVCC_WRITE_FDC(supply)
    FUNC_SUPPORT_EVCC_WRITE_FDC(energy)
    FUNC_SUPPORT_EVCC_WRITE_FDC(statistics)
    FUNC_SUPPORT_EVCC_WRITE_FDC(service_idle)
}

static void OpenChaoJi_gbt27930_b_msg_encode_param_config_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.param_config_secc.pid, 8);
    bs_write(&bs, msg->msg.param_config_secc.parameter_max_charging_volt, 16);
    bs_write(&bs, msg->msg.param_config_secc.parameter_min_charging_volt, 16);
    bs_write(&bs, msg->msg.param_config_secc.parameter_max_charging_curr, 16);
    bs_write(&bs, msg->msg.param_config_secc.parameter_min_charging_curr, 16);
    bs_write(&bs, msg->msg.param_config_secc.parameter_max_discharge_volt, 16);
    bs_write(&bs, msg->msg.param_config_secc.parameter_min_discharge_volt, 16);
    bs_write(&bs, msg->msg.param_config_secc.parameter_max_discharge_curr, 16);
    bs_write(&bs, msg->msg.param_config_secc.parameter_min_discharge_curr, 16);
    bs_write(&bs, msg->msg.param_config_secc.parameter_raise_rate_curr, 16);
    bs_write(&bs, msg->msg.param_config_secc.parameter_reduce_rate_curr, 16);
}


static void OpenChaoJi_gbt27930_b_msg_encode_param_config_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.param_config_evcc.pid, 8);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_max_charging_curr, 16);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_max_charging_volt, 16);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_max_charging_energy, 16);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_soc, 16);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_max_battery_volt, 16);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_max_battery_temperature, 8);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_max_discharge_energy, 16);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_min_discharge_volt, 16);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_max_discharge_curr, 16);
    bs_write(&bs, msg->msg.param_config_evcc.parameter_min_discharge_curr, 8);
}
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_AUTH == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_RFID == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_encode_auth_rfid_param_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.auth_rfid_param_secc.pid, 8);
    bs_write(&bs, msg->msg.auth_rfid_param_secc.c_authen_status, 8);
    bs_write(&bs, msg->msg.auth_rfid_param_secc.m_time, 16);
}

static void OpenChaoJi_gbt27930_b_msg_encode_auth_rfid_wait_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.auth_rfid_wait_evcc.pid, 8);
    bs_write(&bs, msg->msg.auth_rfid_wait_evcc.v_authen_status, 8);
}


static void OpenChaoJi_gbt27930_b_msg_encode_auth_rfid_result_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.auth_rfid_result_secc.pid, 8);
    bs_write(&bs, msg->msg.auth_rfid_result_secc.authen_result, 8);
}
#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_EVIN == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_encode_auth_evin_req_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.auth_evin_req_secc.pid, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_auth_evin_param_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.auth_evin_param_evcc.pid, 8);
    for (int i = 0; i < 17; i++)
    {
        bs_write(&bs, msg->msg.auth_evin_param_evcc.evin[i], 8);
    }
}

static void OpenChaoJi_gbt27930_b_msg_encode_auth_evin_result_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.auth_evin_result_secc.pid, 8);
    bs_write(&bs, msg->msg.auth_evin_result_secc.authen_result, 8);
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_RESERVE == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_RESERVE_EVCC == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_encode_reserve_info_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.reserve_info_secc.pid, 8);
    bs_write(&bs, msg->msg.reserve_info_secc.max_power, 16);
    bs_write(&bs, msg->msg.reserve_info_secc.coded_time, 8);
    for (int i = 0; i < 192; i++)
    {
        bs_write(&bs, msg->msg.reserve_info_secc.power_rate[i], 8);
    }
}

static void OpenChaoJi_gbt27930_b_msg_encode_reserve_confirm_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.reserve_confirm_secc.pid, 8);
    bs_write(&bs, msg->msg.reserve_confirm_secc.reservation_confirm, 8);
    bs_write(&bs, msg->msg.reserve_confirm_secc.charging_now_flag, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_reserve_info_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.reserve_info_evcc.pid, 8);
    bs_write(&bs, msg->msg.reserve_info_evcc.start_time, 16);
    bs_write(&bs, msg->msg.reserve_info_evcc.set_out_time, 16);
}

static void OpenChaoJi_gbt27930_b_msg_encode_reserve_nego_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.reserve_nego_evcc.pid, 8);
    bs_write(&bs, msg->msg.reserve_nego_evcc.consult_result, 8);
    bs_write(&bs, msg->msg.reserve_nego_evcc.charging_now_flag, 8);
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SELFCHECK == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SELFCHECK_GENERAL == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_encode_selfcheck_status_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.selfcheck_status_secc.pid, 8);
    bs_write(&bs, msg->msg.selfcheck_status_secc.check_adhesion_status, 8);
    bs_write(&bs, msg->msg.selfcheck_status_secc.check_short_circuit_status, 8);
    bs_write(&bs, msg->msg.selfcheck_status_secc.check_insulation_status, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_selfcheck_result_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.selfcheck_result_secc.pid, 8);
    bs_write(&bs, msg->msg.selfcheck_result_secc.check_adhesion_result, 8);
    bs_write(&bs, msg->msg.selfcheck_result_secc.check_short_circuit_result, 8);
    bs_write(&bs, msg->msg.selfcheck_result_secc.check_insulation_result, 8);
}
    #endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SUPPLY == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SUPPLY_BASIC == CONFIG_YES)
    #endif

#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_CHARGING == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_encode_charging_ready_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.charging_ready_secc.pid, 8);
    bs_write(&bs, msg->msg.charging_ready_secc.ready_status, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_charging_ready_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.charging_ready_evcc.pid, 8);
    bs_write(&bs, msg->msg.charging_ready_evcc.voltage, 16);
    bs_write(&bs, msg->msg.charging_ready_evcc.ready_status, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_charging_requirement_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.charging_requirement_evcc.pid, 8);
    bs_write(&bs, msg->msg.charging_requirement_evcc.voltage, 16);
    bs_write(&bs, msg->msg.charging_requirement_evcc.current, 16);
    bs_write(&bs, msg->msg.charging_requirement_evcc.charge_mode, 8);
}


static void OpenChaoJi_gbt27930_b_msg_encode_charging_info_basic_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.charging_info_basic_evcc.pid, 8);
    bs_write(&bs, msg->msg.charging_info_basic_evcc.soc, 16);
    bs_write(&bs, msg->msg.charging_info_basic_evcc.left_time, 16);
}


static void OpenChaoJi_gbt27930_b_msg_encode_charging_info_battery_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.charging_info_battery_evcc.pid, 8);
    bs_write(&bs, msg->msg.charging_info_battery_evcc.voltage_max, 16);
    bs_write(&bs, msg->msg.charging_info_battery_evcc.voltage_min, 16);
    bs_write(&bs, msg->msg.charging_info_battery_evcc.temperature_max, 8);
    bs_write(&bs, msg->msg.charging_info_battery_evcc.temperature_min, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_charging_ability_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.charging_ability_secc.pid, 8);
    bs_write(&bs, msg->msg.charging_ability_secc.current, 16);
    bs_write(&bs, msg->msg.charging_ability_secc.reason, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_charging_pause_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.charging_pause_secc.pid, 8);
    bs_write(&bs, msg->msg.charging_pause_secc.pause_status, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_charging_pause_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.charging_pause_evcc.pid, 8);
    bs_write(&bs, msg->msg.charging_pause_evcc.pause_status, 8);
}
#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_DISCHARGING == CONFIG_YES)
    #endif


#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_STATISTICS == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_STATISTICS == CONFIG_YES)


static void OpenChaoJi_gbt27930_b_msg_encode_statistics_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.statistics_secc.pid, 8);
    bs_write(&bs, msg->msg.statistics_secc.charge_total_energy, 16);
}

static void OpenChaoJi_gbt27930_b_msg_encode_statistics_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.statistics_evcc.pid, 8);
    bs_write(&bs, msg->msg.statistics_evcc.charge_stop_SOC, 16);
}
    #endif

#endif

static void OpenChaoJi_gbt27930_b_msg_encode_public_phase_info_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.phase_info_secc.pid, 8);
    bs_write(&bs, msg->msg.phase_info_secc.fc_type, 8);
    bs_write(&bs, msg->msg.phase_info_secc.fdc_type, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_public_phase_ack_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.phase_ack_evcc.pid, 8);
    bs_write(&bs, msg->msg.phase_ack_evcc.phase_ack, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_public_stop_info_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.stop_info_secc.pid, 8);
    bs_write(&bs, msg->msg.stop_info_secc.end_code, 8);
    bs_write(&bs, msg->msg.stop_info_secc.end_Reason, 8);
    for (int i = 0; i < 4; i++)
    {
        bs_write(&bs, msg->msg.stop_info_secc.fault_code[i], 8);
    }
}

static void OpenChaoJi_gbt27930_b_msg_encode_public_stop_info_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.stop_info_evcc.pid, 8);
    bs_write(&bs, msg->msg.stop_info_evcc.end_code, 8);
    bs_write(&bs, msg->msg.stop_info_evcc.end_Reason, 8);
    for (int i = 0; i < 4; i++)
    {
        bs_write(&bs, msg->msg.stop_info_evcc.fault_code[i], 8);
    }
}

static void OpenChaoJi_gbt27930_b_msg_encode_public_relay_status_secc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.relay_status_secc.pid, 8);
    bs_write(&bs, msg->msg.relay_status_secc.contact_c1, 8);
    bs_write(&bs, msg->msg.relay_status_secc.contact_c2, 8);
}

static void OpenChaoJi_gbt27930_b_msg_encode_public_relay_status_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.relay_status_evcc.pid, 8);
    bs_write(&bs, msg->msg.relay_status_evcc.contact_c5, 8);
    bs_write(&bs, msg->msg.relay_status_evcc.contact_c6, 8);

}

static void OpenChaoJi_gbt27930_b_msg_encode_public_latching_status_evcc(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    bs_t bs;
    bs_init(&bs, data, max_len);

    bs_write(&bs, msg->msg.latching_status_evcc.pid, 8);
    bs_write(&bs, msg->msg.latching_status_evcc.latching_status, 8);
}

/**
 * @function OpenChaoJi_gbt27930_b_msg_encode
 * @brief 编码
 * @param msg 消息结构体(输入)
 * @param data 数据(输出)
 * @param max_len 数据最大长度
 * @return int 实际编码数据长度, 小于0表示失败
 */
int OpenChaoJi_gbt27930_b_msg_encode(struct OpenChaoJi_gbt27930_b_msg *msg, unsigned char *data, int max_len)
{
    if (msg == NULL || data == NULL) {
        LOG_CRIT("msg or data is NULL");
        return 0;
    }

    int pgi_len = OpenChaoJi_gbt27930_b_msg_len(msg->pid);

    if (max_len < pgi_len) {
        LOG_ERR("gbt_b max_len[%d] < pgi_len[%d]", max_len, pgi_len);
        return false;
    }

    switch (msg->pid) {
    case OPENCHAOJI_GBT27930_B_PGI_FUNC_NEGO_SECC: OpenChaoJi_gbt27930_b_msg_encode_func_nego_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_FUNC_NEGO_EVCC: OpenChaoJi_gbt27930_b_msg_encode_func_nego_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_PARAM_CONFIG_SECC: OpenChaoJi_gbt27930_b_msg_encode_param_config_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_PARAM_CONFIG_EVCC: OpenChaoJi_gbt27930_b_msg_encode_param_config_evcc(msg, data, max_len); break;
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_AUTH == CONFIG_YES)
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_RFID == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_PARAM_SECC: OpenChaoJi_gbt27930_b_msg_encode_auth_rfid_param_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_WAIT_EVCC: OpenChaoJi_gbt27930_b_msg_encode_auth_rfid_wait_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_RESULT_SECC: OpenChaoJi_gbt27930_b_msg_encode_auth_rfid_result_secc(msg, data, max_len); break;
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_EVIN == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_REQ_SECC: OpenChaoJi_gbt27930_b_msg_encode_auth_evin_req_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_PARAM_EVCC: OpenChaoJi_gbt27930_b_msg_encode_auth_evin_param_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_RESULT_SECC: OpenChaoJi_gbt27930_b_msg_encode_auth_evin_result_secc(msg, data, max_len); break;
#endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_RESERVE == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_RESERVE_EVCC == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_INFO_SECC: OpenChaoJi_gbt27930_b_msg_encode_reserve_info_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_CONFIRM_SECC: OpenChaoJi_gbt27930_b_msg_encode_reserve_confirm_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_INFO_EVCC: OpenChaoJi_gbt27930_b_msg_encode_reserve_info_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_NEGO_EVCC: OpenChaoJi_gbt27930_b_msg_encode_reserve_nego_evcc(msg, data, max_len); break;
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SELFCHECK == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SELFCHECK_GENERAL == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_SELFCHECK_STATUS_SECC: OpenChaoJi_gbt27930_b_msg_encode_selfcheck_status_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_SELFCHECK_RESULT_SECC: OpenChaoJi_gbt27930_b_msg_encode_selfcheck_result_secc(msg, data, max_len); break;
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SUPPLY == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SUPPLY_BASIC == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_STATUS_SECC: OpenChaoJi_gbt27930_b_msg_encode_supply_status_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_STATUS_EVCC: OpenChaoJi_gbt27930_b_msg_encode_supply_status_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_REQUIREMENT_EVCC: OpenChaoJi_gbt27930_b_msg_encode_supply_requirement_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_ABILITY_SECC: OpenChaoJi_gbt27930_b_msg_encode_supply_ability_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_FINISH_EVCC: OpenChaoJi_gbt27930_b_msg_encode_supply_finish_evcc(msg, data, max_len); break;
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_CHARGING == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_READY_SECC: OpenChaoJi_gbt27930_b_msg_encode_charging_ready_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_READY_EVCC: OpenChaoJi_gbt27930_b_msg_encode_charging_ready_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_REQUIREMENT_EVCC: OpenChaoJi_gbt27930_b_msg_encode_charging_requirement_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_INFO_BASIC_EVCC: OpenChaoJi_gbt27930_b_msg_encode_charging_info_basic_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_INFO_BATTERY_EVCC: OpenChaoJi_gbt27930_b_msg_encode_charging_info_battery_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_ABILITY_SECC: OpenChaoJi_gbt27930_b_msg_encode_charging_ability_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_PAUSE_SECC: OpenChaoJi_gbt27930_b_msg_encode_charging_pause_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_PAUSE_EVCC: OpenChaoJi_gbt27930_b_msg_encode_charging_pause_evcc(msg, data, max_len); break;
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_DISCHARGING == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_READY_SECC: OpenChaoJi_gbt27930_b_msg_encode_discharging_ready_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_READY_EVCC: OpenChaoJi_gbt27930_b_msg_encode_discharging_ready_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_REQUIREMENT_EVCC: OpenChaoJi_gbt27930_b_msg_encode_discharging_requirement_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_STATUS_EVCC: OpenChaoJi_gbt27930_b_msg_encode_discharging_status_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_INFO_BASIC_EVCC: OpenChaoJi_gbt27930_b_msg_encode_discharging_info_basic_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_ABILITY_SECC: OpenChaoJi_gbt27930_b_msg_encode_discharging_ability_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_STATUS_SECC: OpenChaoJi_gbt27930_b_msg_encode_discharging_status_secc(msg, data, max_len); break;
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_STATISTICS == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_STATISTICS == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_STATISTICS_SECC: OpenChaoJi_gbt27930_b_msg_encode_statistics_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_STATISTICS_EVCC: OpenChaoJi_gbt27930_b_msg_encode_statistics_evcc(msg, data, max_len); break;
    #endif
#endif
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_PHASE_INFO_SECC: OpenChaoJi_gbt27930_b_msg_encode_public_phase_info_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_PHASE_ACK_EVCC: OpenChaoJi_gbt27930_b_msg_encode_public_phase_ack_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_STOP_INFO_SECC: OpenChaoJi_gbt27930_b_msg_encode_public_stop_info_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_STOP_INFO_EVCC: OpenChaoJi_gbt27930_b_msg_encode_public_stop_info_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_RELAY_STATUS_SECC: OpenChaoJi_gbt27930_b_msg_encode_public_relay_status_secc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_RELAY_STATUS_EVCC: OpenChaoJi_gbt27930_b_msg_encode_public_relay_status_evcc(msg, data, max_len); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_LATCHING_STATUS_EVCC: OpenChaoJi_gbt27930_b_msg_encode_public_latching_status_evcc(msg, data, max_len); break;
    default:
        return 0;
    }

    return pgi_len;
}


/**
 * @function OpenChaoJi_gbt27930_b_msg_encode_data
 * @brief 编码, 并动态分配内存
 * @param msg 消息结构体(输入)
 * @param data_len 数据长度(输出)
 * @return unsigned char * 编码数据 NULL表示失败
 */
unsigned char * OpenChaoJi_gbt27930_b_msg_encode_data(struct OpenChaoJi_gbt27930_b_msg *msg, int * data_len)
{
    if (msg == NULL || data_len == NULL)
    {
        return NULL;
    }

    unsigned char *data = NULL;
    int max_len = OpenChaoJi_gbt27930_b_msg_len(msg->pid);
    data = (unsigned char *)OpenChaoJi_os_malloc(max_len);
    if (data == NULL)
    {
        return NULL;
    }

    int dst_len = OpenChaoJi_gbt27930_b_msg_encode(msg, data, max_len);
    if (dst_len <= 0)
    {
        OpenChaoJi_os_free(data);
        return NULL;
    }

    *data_len = dst_len;
    return data;
}

/*********************************************************************************************************************************************/
#define GBT27930_B_MSG_LOG LOG_NOTICE

/**
 * 各类型PGI日志
 */
static void OpenChaoJi_gbt27930_b_msg_log_func_nego_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    char tmp[101];

    GBT27930_B_MSG_LOG("func_nego_secc");

#define FUNC_SUPPORT_SECC_LOG_FDC(FDC_NAME) \
    snprintf(tmp, 100, "\t" #FDC_NAME ":[%d %d %d %d %d %d %d %d]" \
        , msg->msg.func_support_secc.fdc_support_##FDC_NAME[0], msg->msg.func_support_secc.fdc_support_##FDC_NAME[1] \
        , msg->msg.func_support_secc.fdc_support_##FDC_NAME[2], msg->msg.func_support_secc.fdc_support_##FDC_NAME[3] \
        , msg->msg.func_support_secc.fdc_support_##FDC_NAME[4], msg->msg.func_support_secc.fdc_support_##FDC_NAME[5] \
        , msg->msg.func_support_secc.fdc_support_##FDC_NAME[6], msg->msg.func_support_secc.fdc_support_##FDC_NAME[7]); \
    GBT27930_B_MSG_LOG("%s", tmp);

    FUNC_SUPPORT_SECC_LOG_FDC(auth)
    FUNC_SUPPORT_SECC_LOG_FDC(reserve)
    FUNC_SUPPORT_SECC_LOG_FDC(selfcheck)
    FUNC_SUPPORT_SECC_LOG_FDC(supply)
    FUNC_SUPPORT_SECC_LOG_FDC(energy)
    FUNC_SUPPORT_SECC_LOG_FDC(statistics)
    FUNC_SUPPORT_SECC_LOG_FDC(service_idle)
}

static void OpenChaoJi_gbt27930_b_msg_log_func_nego_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("func_nego_evcc");

#define FUNC_SUPPORT_EVCC_LOG_FDC(FDC_NAME) \
    GBT27930_B_MSG_LOG("\t "#FDC_NAME"=%d", msg->msg.func_support_evcc.fdc_##FDC_NAME);

    FUNC_SUPPORT_EVCC_LOG_FDC(auth)
    FUNC_SUPPORT_EVCC_LOG_FDC(reserve)
    FUNC_SUPPORT_EVCC_LOG_FDC(selfcheck)
    FUNC_SUPPORT_EVCC_LOG_FDC(supply)
    FUNC_SUPPORT_EVCC_LOG_FDC(energy)
    FUNC_SUPPORT_EVCC_LOG_FDC(statistics)
    FUNC_SUPPORT_EVCC_LOG_FDC(service_idle)
}

static void OpenChaoJi_gbt27930_b_msg_log_param_config_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("param_config_secc");

    GBT27930_B_MSG_LOG("\t max_charging_volt=%d(0.1V)", msg->msg.param_config_secc.parameter_max_charging_volt);
    GBT27930_B_MSG_LOG("\t min_charging_volt=%d(0.1V)", msg->msg.param_config_secc.parameter_min_charging_volt);
    GBT27930_B_MSG_LOG("\t max_charging_curr=%d(0.1A)", msg->msg.param_config_secc.parameter_max_charging_curr);
    GBT27930_B_MSG_LOG("\t min_charging_curr=%d(0.1A)", msg->msg.param_config_secc.parameter_min_charging_curr);
    GBT27930_B_MSG_LOG("\t max_discharge_volt=%d(0.1V)", msg->msg.param_config_secc.parameter_max_discharge_volt);
    GBT27930_B_MSG_LOG("\t min_discharge_volt=%d(0.1V)", msg->msg.param_config_secc.parameter_min_discharge_volt);
    GBT27930_B_MSG_LOG("\t max_discharge_curr=%d(0.1A)", msg->msg.param_config_secc.parameter_max_discharge_curr);
    GBT27930_B_MSG_LOG("\t min_discharge_curr=%d(0.1A)", msg->msg.param_config_secc.parameter_min_discharge_curr);
    GBT27930_B_MSG_LOG("\t raise_rate_curr=%d(1A/s)", msg->msg.param_config_secc.parameter_raise_rate_curr);
    GBT27930_B_MSG_LOG("\t reduce_rate_curr=%d(1A/s)", msg->msg.param_config_secc.parameter_reduce_rate_curr);
}

static void OpenChaoJi_gbt27930_b_msg_log_param_config_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("param_config_evcc");

    GBT27930_B_MSG_LOG("\t max_charging_curr=%d(0.1V)", msg->msg.param_config_evcc.parameter_max_charging_curr);
    GBT27930_B_MSG_LOG("\t max_charging_volt=%d(0.1V)", msg->msg.param_config_evcc.parameter_max_charging_volt);
    GBT27930_B_MSG_LOG("\t max_charging_energy=%d(0.1kWh)", msg->msg.param_config_evcc.parameter_max_charging_energy);
    GBT27930_B_MSG_LOG("\t soc=%d(0.1%%)", msg->msg.param_config_evcc.parameter_soc);
    GBT27930_B_MSG_LOG("\t max_battery_volt=%d(0.1V)", msg->msg.param_config_evcc.parameter_max_battery_volt);
    GBT27930_B_MSG_LOG("\t max_battery_temperature=%d(-40°C)", msg->msg.param_config_evcc.parameter_max_battery_temperature);
    GBT27930_B_MSG_LOG("\t max_discharge_energy=%d(0.1kWh)", msg->msg.param_config_evcc.parameter_max_discharge_energy);
    GBT27930_B_MSG_LOG("\t min_discharge_volt=%d(0.1V)", msg->msg.param_config_evcc.parameter_min_discharge_volt);
    GBT27930_B_MSG_LOG("\t max_discharge_curr=%d(0.1A)", msg->msg.param_config_evcc.parameter_max_discharge_curr);
    GBT27930_B_MSG_LOG("\t min_discharge_curr=%d(0.1A)", msg->msg.param_config_evcc.parameter_min_discharge_curr);
}

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_AUTH == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_RFID == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_log_auth_rfid_param_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("auth_rfid_param_secc");

    GBT27930_B_MSG_LOG("\t c_authen_status=%s", enum_names_OpenChaoJi_gbt27930_b_CAuthenStatusType(msg->msg.auth_rfid_param_secc.c_authen_status));
    GBT27930_B_MSG_LOG("\t m_time=%d(min)", msg->msg.auth_rfid_param_secc.m_time);
}

static void OpenChaoJi_gbt27930_b_msg_log_auth_rfid_wait_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("auth_rfid_wait_evcc");

    GBT27930_B_MSG_LOG("\t v_authen_status=%s", enum_names_OpenChaoJi_gbt27930_b_VAuthenStatusType(msg->msg.auth_rfid_wait_evcc.v_authen_status));
}

static void OpenChaoJi_gbt27930_b_msg_log_auth_rfid_result_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("auth_rfid_result_secc");

    GBT27930_B_MSG_LOG("\t authen_result=%s", enum_names_OpenChaoJi_gbt27930_b_AuthenResultType(msg->msg.auth_rfid_result_secc.authen_result));
}
    #endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_EVIN == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_log_auth_evin_req_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("auth_vin_req_secc");
}

static void OpenChaoJi_gbt27930_b_msg_log_auth_evin_param_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("auth_vin_param_evcc");

    OpenChaoJi_gbt27930_b_EVINType vin;
    memcpy(vin, msg->msg.auth_evin_param_evcc.evin, 17);
    vin[17] = '\0';
    GBT27930_B_MSG_LOG("\t evin=%s", vin);
}

static void OpenChaoJi_gbt27930_b_msg_log_auth_evin_result_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("auth_vin_result_secc");

    GBT27930_B_MSG_LOG("\t authen_result=%s", enum_names_OpenChaoJi_gbt27930_b_AuthenResultType(msg->msg.auth_evin_result_secc.authen_result));
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_RESERVE == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_RESERVE_EVCC == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_log_reserve_info_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("reserve_info_secc");

    GBT27930_B_MSG_LOG("\t max_power=%d(0.1kW)", msg->msg.reserve_info_secc.max_power);
    GBT27930_B_MSG_LOG("\t coded_time=%d(15min)", msg->msg.reserve_info_secc.coded_time);
}

static void OpenChaoJi_gbt27930_b_msg_log_reserve_confirm_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("reserve_confirm_secc");

    GBT27930_B_MSG_LOG("\t reservation_confirm=%s", enum_names_OpenChaoJi_gbt27930_b_ScheACKType(msg->msg.reserve_confirm_secc.reservation_confirm));
    GBT27930_B_MSG_LOG("\t charging_now_flag=%s", enum_names_OpenChaoJi_gbt27930_b_SupportChargeType(msg->msg.reserve_confirm_secc.charging_now_flag));
}

static void OpenChaoJi_gbt27930_b_msg_log_reserve_info_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("reserve_info_evcc");

    GBT27930_B_MSG_LOG("\t start_time=%d(min)", msg->msg.reserve_info_evcc.start_time);
    GBT27930_B_MSG_LOG("\t set_out_time=%d(min)", msg->msg.reserve_info_evcc.set_out_time);
}
static void OpenChaoJi_gbt27930_b_msg_log_reserve_nego_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("reserve_nego_evcc");

    GBT27930_B_MSG_LOG("\t consult_result=%s", enum_names_OpenChaoJi_gbt27930_b_ScheNegoType(msg->msg.reserve_nego_evcc.consult_result));
    GBT27930_B_MSG_LOG("\t charging_now_flag=%s", enum_names_OpenChaoJi_gbt27930_b_SupportChargeType(msg->msg.reserve_nego_evcc.charging_now_flag));
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SELFCHECK == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SELFCHECK_GENERAL == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_log_selfcheck_status_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("selfcheck_status_secc");

    GBT27930_B_MSG_LOG("\t check_adhesion_status=%s", enum_names_OpenChaoJi_gbt27930_b_CheckType(msg->msg.selfcheck_status_secc.check_adhesion_status));
    GBT27930_B_MSG_LOG("\t check_short_circuit_status=%s", enum_names_OpenChaoJi_gbt27930_b_CheckType(msg->msg.selfcheck_status_secc.check_short_circuit_status));
    GBT27930_B_MSG_LOG("\t check_insulation_status=%s", enum_names_OpenChaoJi_gbt27930_b_CheckType(msg->msg.selfcheck_status_secc.check_insulation_status));
}
static void OpenChaoJi_gbt27930_b_msg_log_selfcheck_result_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("selfcheck_result_secc");

    GBT27930_B_MSG_LOG("\t check_adhesion_result=%s", enum_names_OpenChaoJi_gbt27930_b_CheckResult(msg->msg.selfcheck_result_secc.check_adhesion_result));
    GBT27930_B_MSG_LOG("\t check_short_circuit_result=%s", enum_names_OpenChaoJi_gbt27930_b_CheckResult(msg->msg.selfcheck_result_secc.check_short_circuit_result));
    GBT27930_B_MSG_LOG("\t check_insulation_result=%s", enum_names_OpenChaoJi_gbt27930_b_CheckResult(msg->msg.selfcheck_result_secc.check_insulation_result));
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SUPPLY == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SUPPLY_BASIC == CONFIG_YES)
#endif

#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_CHARGING == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_log_charging_ready_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("charging_ready_secc");

    GBT27930_B_MSG_LOG("\t ready_status=%s", enum_names_OpenChaoJi_gbt27930_b_ReadyType(msg->msg.charging_ready_secc.ready_status));
}
static void OpenChaoJi_gbt27930_b_msg_log_charging_ready_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("charging_ready_evcc");

    GBT27930_B_MSG_LOG("\t voltage=%d(0.1V)", msg->msg.charging_ready_evcc.voltage);
    GBT27930_B_MSG_LOG("\t ready_status=%s", enum_names_OpenChaoJi_gbt27930_b_ReadyType(msg->msg.charging_ready_evcc.ready_status));
}
static void OpenChaoJi_gbt27930_b_msg_log_charging_requirement_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("charging_requirement_evcc");

    GBT27930_B_MSG_LOG("\t voltage=%d(0.1V)", msg->msg.charging_requirement_evcc.voltage);
    GBT27930_B_MSG_LOG("\t current=%d(0.1A)", msg->msg.charging_requirement_evcc.current);
    GBT27930_B_MSG_LOG("\t charge_mode=%s", enum_names_OpenChaoJi_gbt27930_b_ChargeModeType(msg->msg.charging_requirement_evcc.charge_mode));
}
static void OpenChaoJi_gbt27930_b_msg_log_charging_info_basic_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("charging_info_basic_evcc");

    GBT27930_B_MSG_LOG("\t soc=%d(0.1%%)", msg->msg.charging_info_basic_evcc.soc);
    GBT27930_B_MSG_LOG("\t left_time=%d(min)", msg->msg.charging_info_basic_evcc.left_time);
}
static void OpenChaoJi_gbt27930_b_msg_log_charging_info_battery_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("charging_info_battery_evcc");

    GBT27930_B_MSG_LOG("\t voltage_max=%d(0.001V)", msg->msg.charging_info_battery_evcc.voltage_max);
    GBT27930_B_MSG_LOG("\t voltage_min=%d(0.001V)", msg->msg.charging_info_battery_evcc.voltage_min);
    GBT27930_B_MSG_LOG("\t temperature_max=%d(-40°)", msg->msg.charging_info_battery_evcc.temperature_max);
    GBT27930_B_MSG_LOG("\t temperature_max=%d(-40°)", msg->msg.charging_info_battery_evcc.temperature_min);
}
static void OpenChaoJi_gbt27930_b_msg_log_charging_ability_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("charging_ability_secc");

    GBT27930_B_MSG_LOG("\t current=%d(0.1A)", msg->msg.charging_ability_secc.current);
    GBT27930_B_MSG_LOG("\t reason=%s", enum_names_OpenChaoJi_gbt27930_b_ReasonType(msg->msg.charging_ability_secc.reason));
}
static void OpenChaoJi_gbt27930_b_msg_log_charging_pause_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("charging_pause_secc");

    GBT27930_B_MSG_LOG("\t pause_status=%s", enum_names_OpenChaoJi_gbt27930_b_PauseStatusType(msg->msg.charging_pause_secc.pause_status));
}
static void OpenChaoJi_gbt27930_b_msg_log_charging_pause_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("charging_pause_evcc");

    GBT27930_B_MSG_LOG("\t pause_status=%s", enum_names_OpenChaoJi_gbt27930_b_PauseStatusType(msg->msg.charging_pause_evcc.pause_status));
}
#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_DISCHARGING == CONFIG_YES)
#endif


#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_STATISTICS == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_STATISTICS == CONFIG_YES)

static void OpenChaoJi_gbt27930_b_msg_log_statistics_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("statistics_secc");

    GBT27930_B_MSG_LOG("\t charge_total_energy=%d(0.1kWh)", msg->msg.statistics_secc.charge_total_energy);
}
static void OpenChaoJi_gbt27930_b_msg_log_statistics_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("statistics_evcc");

    GBT27930_B_MSG_LOG("\t charge_stop_SOC=%d(0.1%%)", msg->msg.statistics_evcc.charge_stop_SOC);
}
#endif

#endif

static void OpenChaoJi_gbt27930_b_msg_log_public_phase_info_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("public_phase_info_secc");

    GBT27930_B_MSG_LOG("\t FC=%s", enum_names_OpenChaoJi_gbt27930_b_FCType(msg->msg.phase_info_secc.fc_type));
    GBT27930_B_MSG_LOG("\t FDC=%d", msg->msg.phase_info_secc.fdc_type);
}

static void OpenChaoJi_gbt27930_b_msg_log_public_phase_ack_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("public_phase_ack_evcc");

    GBT27930_B_MSG_LOG("\t phase_ack=%s", enum_names_OpenChaoJi_gbt27930_b_PhaseACKType(msg->msg.phase_ack_evcc.phase_ack));
}

static void OpenChaoJi_gbt27930_b_msg_log_public_stop_info_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("public_stop_info_secc");

    // TODO: 转化为可读字符串
    GBT27930_B_MSG_LOG("\t end_code=%d", msg->msg.stop_info_secc.end_code);
    GBT27930_B_MSG_LOG("\t end_reason=%d", msg->msg.stop_info_secc.end_Reason);
}

static void OpenChaoJi_gbt27930_b_msg_log_public_stop_info_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("public_stop_info_evcc");

    // TODO: 转化为可读字符串
    GBT27930_B_MSG_LOG("\t end_code=%d", msg->msg.stop_info_evcc.end_code);
    GBT27930_B_MSG_LOG("\t end_reason=%d", msg->msg.stop_info_evcc.end_Reason);
}

static void OpenChaoJi_gbt27930_b_msg_log_public_relay_status_secc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("public_relay_status_secc");

    GBT27930_B_MSG_LOG("\t C1=%s", enum_names_OpenChaoJi_gbt27930_b_ContactStatusType(msg->msg.relay_status_secc.contact_c1));
    GBT27930_B_MSG_LOG("\t C2=%s", enum_names_OpenChaoJi_gbt27930_b_ContactStatusType(msg->msg.relay_status_secc.contact_c2));
}

static void OpenChaoJi_gbt27930_b_msg_log_public_relay_status_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("public_relay_status_evcc");

    GBT27930_B_MSG_LOG("\t C5=%s", enum_names_OpenChaoJi_gbt27930_b_ContactStatusType(msg->msg.relay_status_evcc.contact_c5));
    GBT27930_B_MSG_LOG("\t C6=%s", enum_names_OpenChaoJi_gbt27930_b_ContactStatusType(msg->msg.relay_status_evcc.contact_c6));
}

static void OpenChaoJi_gbt27930_b_msg_log_public_latching_status_evcc(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    GBT27930_B_MSG_LOG("public_latching_status_evcc");

    GBT27930_B_MSG_LOG("\t latching_status=%s", enum_names_OpenChaoJi_gbt27930_b_LatchingStatusType(msg->msg.latching_status_evcc.latching_status));
}

/**
 * @function OpenChaoJi_gbt27930_b_msg_log
 * @brief 日志
 * @param msg 消息结构体
 * @return void
 */
extern void OpenChaoJi_gbt27930_b_msg_log(const struct OpenChaoJi_gbt27930_b_msg *msg)
{
    if (msg == NULL) {
        return;
    }

    switch (msg->pid) {
    case OPENCHAOJI_GBT27930_B_PGI_FUNC_NEGO_SECC: OpenChaoJi_gbt27930_b_msg_log_func_nego_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_FUNC_NEGO_EVCC: OpenChaoJi_gbt27930_b_msg_log_func_nego_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_PARAM_CONFIG_SECC: OpenChaoJi_gbt27930_b_msg_log_param_config_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_PARAM_CONFIG_EVCC: OpenChaoJi_gbt27930_b_msg_log_param_config_evcc(msg); break;
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_AUTH == CONFIG_YES)
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_RFID == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_PARAM_SECC: OpenChaoJi_gbt27930_b_msg_log_auth_rfid_param_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_WAIT_EVCC: OpenChaoJi_gbt27930_b_msg_log_auth_rfid_wait_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_RFID_RESULT_SECC: OpenChaoJi_gbt27930_b_msg_log_auth_rfid_result_secc(msg); break;
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_EVIN == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_REQ_SECC: OpenChaoJi_gbt27930_b_msg_log_auth_evin_req_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_PARAM_EVCC: OpenChaoJi_gbt27930_b_msg_log_auth_evin_param_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_AUTH_EVIN_RESULT_SECC: OpenChaoJi_gbt27930_b_msg_log_auth_evin_result_secc(msg); break;
#endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_RESERVE == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_RESERVE_EVCC == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_INFO_SECC: OpenChaoJi_gbt27930_b_msg_log_reserve_info_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_CONFIRM_SECC: OpenChaoJi_gbt27930_b_msg_log_reserve_confirm_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_INFO_EVCC: OpenChaoJi_gbt27930_b_msg_log_reserve_info_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_RESERVE_NEGO_EVCC: OpenChaoJi_gbt27930_b_msg_log_reserve_nego_evcc(msg); break;
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SELFCHECK == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SELFCHECK_GENERAL == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_SELFCHECK_STATUS_SECC: OpenChaoJi_gbt27930_b_msg_log_selfcheck_status_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_SELFCHECK_RESULT_SECC: OpenChaoJi_gbt27930_b_msg_log_selfcheck_result_secc(msg); break;
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SUPPLY == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SUPPLY_BASIC == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_STATUS_SECC: OpenChaoJi_gbt27930_b_msg_log_supply_status_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_STATUS_EVCC: OpenChaoJi_gbt27930_b_msg_log_supply_status_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_REQUIREMENT_EVCC: OpenChaoJi_gbt27930_b_msg_log_supply_requirement_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_ABILITY_SECC: OpenChaoJi_gbt27930_b_msg_log_supply_ability_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_SUPPLY_FINISH_EVCC: OpenChaoJi_gbt27930_b_msg_log_supply_finish_evcc(msg); break;
    #endif
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_CHARGING == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_READY_SECC: OpenChaoJi_gbt27930_b_msg_log_charging_ready_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_READY_EVCC: OpenChaoJi_gbt27930_b_msg_log_charging_ready_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_REQUIREMENT_EVCC: OpenChaoJi_gbt27930_b_msg_log_charging_requirement_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_INFO_BASIC_EVCC: OpenChaoJi_gbt27930_b_msg_log_charging_info_basic_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_INFO_BATTERY_EVCC: OpenChaoJi_gbt27930_b_msg_log_charging_info_battery_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_ABILITY_SECC: OpenChaoJi_gbt27930_b_msg_log_charging_ability_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_PAUSE_SECC: OpenChaoJi_gbt27930_b_msg_log_charging_pause_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_CHARGING_PAUSE_EVCC: OpenChaoJi_gbt27930_b_msg_log_charging_pause_evcc(msg); break;
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_DISCHARGING == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_READY_SECC: OpenChaoJi_gbt27930_b_msg_log_discharging_ready_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_READY_EVCC: OpenChaoJi_gbt27930_b_msg_log_discharging_ready_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_REQUIREMENT_EVCC: OpenChaoJi_gbt27930_b_msg_log_discharging_requirement_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_STATUS_EVCC: OpenChaoJi_gbt27930_b_msg_log_discharging_status_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_INFO_BASIC_EVCC: OpenChaoJi_gbt27930_b_msg_log_discharging_info_basic_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_ABILITY_SECC: OpenChaoJi_gbt27930_b_msg_log_discharging_ability_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_DISCHARGING_STATUS_SECC: OpenChaoJi_gbt27930_b_msg_log_discharging_status_secc(msg); break;
#endif
#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_STATISTICS == CONFIG_YES)
    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_STATISTICS == CONFIG_YES)
    case OPENCHAOJI_GBT27930_B_PGI_STATISTICS_SECC: OpenChaoJi_gbt27930_b_msg_log_statistics_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_STATISTICS_EVCC: OpenChaoJi_gbt27930_b_msg_log_statistics_evcc(msg); break;
    #endif
#endif
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_PHASE_INFO_SECC: OpenChaoJi_gbt27930_b_msg_log_public_phase_info_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_PHASE_ACK_EVCC: OpenChaoJi_gbt27930_b_msg_log_public_phase_ack_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_STOP_INFO_SECC: OpenChaoJi_gbt27930_b_msg_log_public_stop_info_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_STOP_INFO_EVCC: OpenChaoJi_gbt27930_b_msg_log_public_stop_info_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_RELAY_STATUS_SECC: OpenChaoJi_gbt27930_b_msg_log_public_relay_status_secc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_RELAY_STATUS_EVCC: OpenChaoJi_gbt27930_b_msg_log_public_relay_status_evcc(msg); break;
    case OPENCHAOJI_GBT27930_B_PGI_PUBLIC_LATCHING_STATUS_EVCC: OpenChaoJi_gbt27930_b_msg_log_public_latching_status_evcc(msg); break;
    default:
        return;
    }

    return;
}

/**
 * CMP_CPY类型
 */
bool OpenChaoJi_gbt27930_b_msg_cmpcpy_array(int tag, const char * name, uint8_t * dst, const uint8_t * src, int len)
{
    if (memcmp(dst, src, len) != 0)
    {
        LOG_STATUS_CHANGE("[%d]%s changed", tag, name);
        LOG_DATA_BUFF_CHANGE(dst, len);
        LOG_DATA_BUFF_CHANGE(src, len);

        memcpy(dst, src, len);
        return true;
    }

    return false;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(int tag, const char * name, uint8_t * dst, const uint8_t src)
{
    if (*dst != src)
    {
        LOG_STATUS_CHANGE("[%d]%s [%d]->[%d]", tag, name, *dst, src);

        *dst = src;
        return true;
    }

    return false;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(int tag, const char * name, uint16_t * dst, const uint16_t src)
{
    if (*dst != src)
    {
        LOG_STATUS_CHANGE("[%d]%s [%d]->[%d]", tag, name, *dst, src);

        *dst = src;
        return true;
    }

    return false;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_uint32(int tag, const char * name, uint32_t * dst, const uint32_t src)
{
    if (*dst != src)
    {
        LOG_STATUS_CHANGE("[%d]%s [%ld]->[%ld]", tag, name, *dst, src);

        *dst = src;
        return true;
    }

    return false;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(int tag, const char * name, uint8_t * dst, const uint8_t src, const char *(enum_name_func)(int))
{
    if (*dst != src)
    {
        LOG_STATUS_CHANGE("[%d]%s [%s]->[%s]", tag, name, (*enum_name_func)(*dst), (*enum_name_func)(src));

        *dst = src;
        return true;
    }

    return false;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_func_support_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_func_support_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_func_support_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "fdc_support_auth", dst->fdc_support_auth, src->fdc_support_auth, 8)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "fdc_support_reserve", dst->fdc_support_reserve, src->fdc_support_reserve, 8)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "fdc_support_selfcheck", dst->fdc_support_selfcheck, src->fdc_support_selfcheck, 8)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "fdc_support_supply", dst->fdc_support_supply, src->fdc_support_supply, 8)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "fdc_support_energy", dst->fdc_support_energy, src->fdc_support_energy, 8)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "fdc_support_statistics", dst->fdc_support_statistics, src->fdc_support_statistics, 8)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "fdc_support_service_idle", dst->fdc_support_service_idle, src->fdc_support_service_idle, 8)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_func_support_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_func_support_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_func_support_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "fdc_auth", &dst->fdc_auth, src->fdc_auth)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "fdc_reserve", &dst->fdc_reserve, src->fdc_reserve)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "fdc_selfcheck", &dst->fdc_selfcheck, src->fdc_selfcheck)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "fdc_supply", &dst->fdc_supply, src->fdc_supply)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "fdc_energy", &dst->fdc_energy, src->fdc_energy)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "fdc_statistics", &dst->fdc_statistics, src->fdc_statistics)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "fdc_service_idle", &dst->fdc_service_idle, src->fdc_service_idle)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_param_config_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_param_config_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_param_config_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_charging_volt(0.1V)", &dst->parameter_max_charging_volt, src->parameter_max_charging_volt)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_min_charging_volt(0.1V)", &dst->parameter_min_charging_volt, src->parameter_min_charging_volt)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_charging_curr(0.1A)", &dst->parameter_max_charging_curr, src->parameter_max_charging_curr)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_min_charging_curr(0.1A)", &dst->parameter_min_charging_curr, src->parameter_min_charging_curr)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_discharge_volt(0.1V)", &dst->parameter_max_discharge_volt, src->parameter_max_discharge_volt)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_min_discharge_volt(0.1V)", &dst->parameter_min_discharge_volt, src->parameter_min_discharge_volt)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_discharge_curr(0.1A)", &dst->parameter_max_discharge_curr, src->parameter_max_discharge_curr)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_min_discharge_curr(0.1A)", &dst->parameter_min_discharge_curr, src->parameter_min_discharge_curr)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_raise_rate_curr(A/s)", &dst->parameter_raise_rate_curr, src->parameter_raise_rate_curr)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_reduce_rate_curr(A/s)", &dst->parameter_reduce_rate_curr, src->parameter_reduce_rate_curr)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_param_config_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_param_config_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_param_config_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_charging_curr(0.1A)", &dst->parameter_max_charging_curr, src->parameter_max_charging_curr)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_charging_volt(0.1V)", &dst->parameter_max_charging_volt, src->parameter_max_charging_volt)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_charging_energy(0.1kWh)", &dst->parameter_max_charging_energy, src->parameter_max_charging_energy)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_soc(0.1%%)", &dst->parameter_soc, src->parameter_soc)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_battery_volt(0.1V)", &dst->parameter_max_battery_volt, src->parameter_max_battery_volt)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "parameter_max_battery_temperature(-40°)", &dst->parameter_max_battery_temperature, src->parameter_max_battery_temperature)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_discharge_energy(0.1kWh)", &dst->parameter_max_discharge_energy, src->parameter_max_discharge_energy)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_min_discharge_volt(0.1V)", &dst->parameter_min_discharge_volt, src->parameter_min_discharge_volt)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_max_discharge_curr(0.1A)", &dst->parameter_max_discharge_curr, src->parameter_max_discharge_curr)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "parameter_min_discharge_curr(0.1A)", &dst->parameter_min_discharge_curr, src->parameter_min_discharge_curr)) {
        changed = true;
    }

    return changed;
}

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_AUTH == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_RFID == CONFIG_YES)

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_auth_rfid_param_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_auth_rfid_param_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_auth_rfid_param_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "c_authen_status", &dst->c_authen_status, src->c_authen_status, enum_names_OpenChaoJi_gbt27930_b_CAuthenStatusType)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "m_time(min)", &dst->m_time, src->m_time)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_auth_rfid_result_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_auth_rfid_result_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_auth_rfid_result_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "authen_result", &dst->authen_result, src->authen_result, enum_names_OpenChaoJi_gbt27930_b_AuthenResultType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_auth_rfid_wait_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_auth_rfid_wait_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_auth_rfid_wait_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "v_authen_status", &dst->v_authen_status, src->v_authen_status, enum_names_OpenChaoJi_gbt27930_b_VAuthenStatusType)) {
        changed = true;
    }

    return changed;
}
#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_AUTH_EVIN == CONFIG_YES)


bool OpenChaoJi_gbt27930_b_msg_cmpcpy_auth_evin_req_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_auth_evin_req_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_auth_evin_req_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_auth_evin_param_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_auth_evin_param_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_auth_evin_param_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "evin", dst->evin, src->evin, 17)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_auth_evin_result_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_auth_evin_result_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_auth_evin_result_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "authen_result", &dst->authen_result, src->authen_result, enum_names_OpenChaoJi_gbt27930_b_AuthenResultType)) {
        changed = true;
    }

    return changed;
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_RESERVE == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_RESERVE_EVCC == CONFIG_YES)

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_reserve_info_secc(int tag,  struct OpenChaoJi_gbt27930_b_msg_reserve_info_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_reserve_info_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "max_power(0.1kW)", &dst->max_power, src->max_power)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "coded_time(15min)", &dst->coded_time, src->coded_time)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "power_rate", dst->power_rate, src->power_rate, 192)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_reserve_confirm_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_reserve_confirm_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_reserve_confirm_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "reservation_confirm", &dst->reservation_confirm, src->reservation_confirm, enum_names_OpenChaoJi_gbt27930_b_ScheACKType)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "charging_now_flag", &dst->charging_now_flag, src->charging_now_flag, enum_names_OpenChaoJi_gbt27930_b_SupportChargeType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_reserve_info_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_reserve_info_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_reserve_info_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "start_time(min)", &dst->start_time, src->start_time)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "set_out_time(min)", &dst->set_out_time, src->set_out_time)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_reserve_nego_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_reserve_nego_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_reserve_nego_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "consult_result", &dst->consult_result, src->consult_result, enum_names_OpenChaoJi_gbt27930_b_ScheNegoType)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "charging_now_flag", &dst->charging_now_flag, src->charging_now_flag, enum_names_OpenChaoJi_gbt27930_b_SupportChargeType)) {
        changed = true;
    }

    return changed;
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SELFCHECK == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SELFCHECK_GENERAL == CONFIG_YES)

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_selfcheck_status_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_selfcheck_status_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_selfcheck_status_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "check_adhesion_status", &dst->check_adhesion_status, src->check_adhesion_status, enum_names_OpenChaoJi_gbt27930_b_CheckType)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "check_short_circuit_status", &dst->check_short_circuit_status, src->check_short_circuit_status, enum_names_OpenChaoJi_gbt27930_b_CheckType)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "check_insulation_status", &dst->check_insulation_status, src->check_insulation_status, enum_names_OpenChaoJi_gbt27930_b_CheckType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_selfcheck_result_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_selfcheck_result_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_selfcheck_result_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "check_adhesion_result", &dst->check_adhesion_result, src->check_adhesion_result, enum_names_OpenChaoJi_gbt27930_b_CheckResult)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "check_short_circuit_result", &dst->check_short_circuit_result, src->check_short_circuit_result, enum_names_OpenChaoJi_gbt27930_b_CheckResult)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "check_insulation_result", &dst->check_insulation_result, src->check_insulation_result, enum_names_OpenChaoJi_gbt27930_b_CheckResult)) {
        changed = true;
    }

    return changed;
}
#endif

#endif

#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_SUPPLY == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_SUPPLY_BASIC == CONFIG_YES)
    #endif

#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_CHARGING == CONFIG_YES)

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_charging_ready_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_charging_ready_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_charging_ready_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "ready_status", &dst->ready_status, src->ready_status, enum_names_OpenChaoJi_gbt27930_b_ReadyType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_charging_ready_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_charging_ready_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_charging_ready_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "voltage(0.1V)", &dst->voltage, src->voltage)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "ready_status", &dst->ready_status, src->ready_status, enum_names_OpenChaoJi_gbt27930_b_ReadyType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_charging_requirement_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_charging_requirement_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_charging_requirement_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "voltage(0.1V)", &dst->voltage, src->voltage)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "current(0.1A)", &dst->current, src->current)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "charge_mode", &dst->charge_mode, src->charge_mode, enum_names_OpenChaoJi_gbt27930_b_ChargeModeType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_charging_info_basic_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_charging_info_basic_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_charging_info_basic_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "soc(0.1%%)", &dst->soc, src->soc)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "left_time(min)", &dst->left_time, src->left_time)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_charging_info_battery_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_charging_info_battery_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_charging_info_battery_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "voltage_max(0.001V)", &dst->voltage_max, src->voltage_max)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "voltage_min(0.001V)", &dst->voltage_min, src->voltage_min)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "temperature_max(-40°)", &dst->temperature_max, src->temperature_max)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "temperature_max(-40°)", &dst->temperature_min, src->temperature_min)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_charging_ability_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_charging_ability_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_charging_ability_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "current(0.1A)", &dst->current, src->current)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "reason", &dst->reason, src->reason, enum_names_OpenChaoJi_gbt27930_b_ReasonType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_charging_pause_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_charging_pause_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_charging_pause_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "pause_status", &dst->pause_status, src->pause_status, enum_names_OpenChaoJi_gbt27930_b_PauseStatusType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_charging_pause_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_charging_pause_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_charging_pause_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "pause_status", &dst->pause_status, src->pause_status, enum_names_OpenChaoJi_gbt27930_b_PauseStatusType)) {
        changed = true;
    }

    return changed;
}
#endif

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_DISCHARGING == CONFIG_YES)
    #endif


#if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FUNC_STATISTICS == CONFIG_YES)

    #if (OPENCHAOJI_CONFIG_ENABLE_GBT27930_B_FDC_STATISTICS == CONFIG_YES)

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_statistics_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_statistics_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_statistics_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "charge_total_energy(0.1kWh)", &dst->charge_total_energy, src->charge_total_energy)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_statistics_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_statistics_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_statistics_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint16(tag, "charge_stop_SOC(0.1%%)", &dst->charge_stop_SOC, src->charge_stop_SOC)) {
        changed = true;
    }

    return changed;
}
#endif

#endif


bool OpenChaoJi_gbt27930_b_msg_cmpcpy_phase_info_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_phase_info_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_phase_info_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "fc_type", &dst->fc_type, src->fc_type, enum_names_OpenChaoJi_gbt27930_b_FCType)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "fdc_type", &dst->fdc_type, src->fdc_type)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_phase_ack_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_phase_ack_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_phase_ack_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;


    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "phase_ack", &dst->phase_ack, src->phase_ack, enum_names_OpenChaoJi_gbt27930_b_PhaseACKType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_stop_info_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_stop_info_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_stop_info_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "stop_reason", &dst->end_code, src->end_code)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "end_Reason", &dst->end_Reason, src->end_Reason)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "fault_code", dst->fault_code, src->fault_code, 4)) {
        changed = true;
    }

    return changed;
}


bool OpenChaoJi_gbt27930_b_msg_cmpcpy_stop_info_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_stop_info_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_stop_info_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;
    dst->pid = src->pid;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "stop_reason", &dst->end_code, src->end_code)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_uint8(tag, "end_Reason", &dst->end_Reason, src->end_Reason)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_array(tag, "fault_code", dst->fault_code, src->fault_code, 4)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_relay_status_secc(int tag, struct OpenChaoJi_gbt27930_b_msg_relay_status_secc *dst, const struct OpenChaoJi_gbt27930_b_msg_relay_status_secc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "contact_c1", &dst->contact_c1, src->contact_c1, enum_names_OpenChaoJi_gbt27930_b_ContactStatusType)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "contact_c2", &dst->contact_c2, src->contact_c2, enum_names_OpenChaoJi_gbt27930_b_ContactStatusType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_relay_status_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_relay_status_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_relay_status_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "contact_c5", &dst->contact_c5, src->contact_c5, enum_names_OpenChaoJi_gbt27930_b_ContactStatusType)) {
        changed = true;
    }
    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "contact_c6", &dst->contact_c6, src->contact_c6, enum_names_OpenChaoJi_gbt27930_b_ContactStatusType)) {
        changed = true;
    }

    return changed;
}

bool OpenChaoJi_gbt27930_b_msg_cmpcpy_latching_status_evcc(int tag, struct OpenChaoJi_gbt27930_b_msg_latching_status_evcc *dst, const struct OpenChaoJi_gbt27930_b_msg_latching_status_evcc *src)
{
    if (src == NULL || dst == NULL)
    {
        return false;
    }

    bool changed = false;

    if (OpenChaoJi_gbt27930_b_msg_cmpcpy_enum(tag, "latching_status", &dst->latching_status, src->latching_status, enum_names_OpenChaoJi_gbt27930_b_LatchingStatusType)) {
        changed = true;
    }

    return changed;
}

#endif